@BProCalcTableImport @P@ICopyright Gold Disk Inc., January, 1993
This Genie will import a table of data from Professional Calc. You must have ProCalc running first and a box on the page for which the data is destined.
*/
numeric digits 8
cr = '0a'x
options results
address command
call SafeEndEdit.rexx()
units = ppm_GetUnits()
if units = 3 then
call ppm_SetUnits(1)
call ppm_AutoUpdate(0)
signal on halt
signal on break_c
signal on break_e
signal on break_d
if ~show(p, "PCALC") then exit_msg("Please start Professional Calc and select a range before running this Genie.")
box = ppm_ClickOnBox("Click on box in which to import table..")
if box = 0 then exit_msg()
/* extract box attributes */
boxsize = ppm_GetBoxSize(box)
boxposition = ppm_GetBoxPosition(box)
if ppm_Inform(2, "Delete box?",) = 1 then call ppm_DeleteBox(box)
/* tell user to start up ProCalc */
call ppm_Inform(1, "Select Range in ProCalc",)
call ppm_ShowStatus("Extracting range from ProCalc")
/* switch to ProCalc and start processing */
address "PCALC"
ActivateWindow
DrawMessage "Please enter Range"
'Suppress'
'LockGUI'
/* get range selected by user */
'Current'
range = upper(result)
if range = '' then exit_msg("No range selected")
colon_pos = pos(':', range)
if colon_pos = 0 then exit_msg("No range selected")
/* extract the start cell and the end cell */
start_cell = substr(range, 1, colon_pos - 1)
end_cell = substr(range, colon_pos + 1)
if end_cell = '' | start_cell = '' then exit_msg("Invalid Range")
/* make sure that we go from top left to bottom right */